import request from "@/utils/request";


// 新登录
export function backAdminauthApilogin(data) {
  return request({
    url: `/backAdmin/authApi/login`,
    method: "post",
    data: data
  });
}

// 新登录绑定
export function backAdminauthApiloginbind(data) {
  return request({
    url: `/backAdmin/authApi/login/bind`,
    method: "post",
    data: data,
  });
}


// 获取商家信息
export function authApibindmerchantinfo() {
  return request({
    url: `/backAdmin/authApi/bind/merchant/info`,
    method: "get",
  });
}

// 查询可管理的区域列表
export function authApiAreaList(query) {
  return request({
    url: "/backAdmin/authApi/area/list",
    method: "get",
    params: query,
  });
}
//查询可管理的行业列表
export function authApiIndustryList(query) {
  return request({
    url: "/backAdmin/authApi/industry/list",
    method: "get",
    params: query,
  });
}

// 查询可管理的系统列表
export function authApiindustrysystemlist(query) {
  return request({
    url: `/backAdmin/authApi/industry/system/list`,
    method: "get",
    params: query,
  });
}

// 机构管理员查询商家列表 查询可管理的商家列表
export function loginMerchantList(query) {
  return request({
    url: `/backAdmin/authApi/merchant/list`,
    method: "get",
    params: query,
  });
}




// 菜单是否显示信息
export function authApiRouterInfo(menuId) {
  return request({
    url: `/backAdmin/authApi/router/info?menuId=${menuId}`,
    method: "get",
  });
}


// 登录方法
export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid,
  };
  return request({
    url: "/login",
    headers: {
      isToken: false,
      repeatSubmit: false,
    },
    method: "post",
    data: data,
  });
}

// 公司管理系统登录
export function loginCompany(data) {
  return request({
    url: "/backAdmin/authApi/login/company",
    headers: {
      isToken: false,
      repeatSubmit: false,
    },
    method: "post",
    data: data,
  });
}

// 系统管理员登录
export function loginAdmin(username, password, code, uuid, phone) {
  const data = {
    username,
    password,
    code,
    uuid,
    phone,
  };
  return request({
    url: "/backAdmin/authApi/login/admin",
    headers: {
      isToken: false,
      repeatSubmit: false,
    },
    method: "post",
    data: data,
  });
}
// 机构管理员登录
export function loginMerc(data) {
  return request({
    url: "/backAdmin/authApi/login/merc",
    headers: {
      isToken: false,
      repeatSubmit: false,
    },
    method: "post",
    data: data,
  });
}

// 绑定商家
export function merchantBind(data) {
  // let { merchantId, areaId, industryId } = data

  // if(!areaId ){

  // }
  // params: query
  return request({
    // url: `/backAdmin/authApi/bind/merchant?merchantId=${merchantId}&areaId=${areaId}&industryId=${industryId}`,
    url: `/backAdmin/authApi/bind/merchant`,
    method: "post",
    params: data,
  });
}

// 注册方法
export function register(data) {
  return request({
    url: "/register",
    headers: {
      isToken: false,
    },
    method: "post",
    data: data,
  });
}

// 获取用户详细信息
export function getInfo() {
  return request({
    // url: '/getInfo',
    url: "/backAdmin/authApi/getInfo",
    method: "get",
  });
}

// 退出方法
export function logout() {
  return request({
    url: "/logout",
    method: "post",
  });
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: "/captchaImage",
    headers: {
      isToken: false,
    },
    method: "get",
    timeout: 20000,
  });
}
